import axios from "axios"

export default {
    async getPetowners(q = {}) {
        const resp = await axios.get("/api/petowners/all", {
            params: q
        })
        return resp.data;
    },
    async addPetowners(petowners) {
        const resp = await axios.post("/api/petowners/add", petowners)
        return resp.data;
    },
    async deletePetowners(id) {
        await axios.delete("/api/petowners/" + id)
    },
    async getPetownersById(id) {
        const resp = await axios.get("/api/petowners/" + id)
        return resp.data
    },
    async updatePetowners(petowners) {
        await axios.put("/api/petowners/" + petowners._id, petowners)
    },
    async addpet(petowners) {
        await axios.put("/api/petowners/addpet/" + petowners._id, JSON.stringify(petowners.pet), {
            headers: { "Content-Type": "application/json" }
        })
    },
    async getByPetId(petId) {
        const resp = await axios.get("/api/petowners/pet/" + petId)
        return resp.data
    }

}